package com.project.controller;

import com.project.bean.ReplayBean;
import com.project.bean.UserBean;
import com.project.service.IReplayService;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("replay")
public class ReplayController {
    @Autowired
    private IReplayService service;
    @RequestMapping("addReplay")
    public String addReplay(ReplayBean replay,HttpServletRequest req){
                //先从session中，得到登陆用户
        UserBean user =(UserBean) req.getSession().getAttribute("loginUser");
        replay.setUserId(user.getId());
        System.out.println(replay.getUserId());
        service.addReplay(replay);
        return "ok";
    }
}
